﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Account/Account.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Register Src="~/Views/Shared/TextBox.ascx" TagName="textbox" TagPrefix="uc" %>
<%@ Register Src="~/Views/Shared/Button.ascx" TagName="button" TagPrefix="uc" %>
<%@ Register src="~/Views/Shared/TextArea.ascx" tagname="textarea" tagprefix="uc" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	My Account
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
<script>
    $(document).ready(function (e) {
        $("#cmbCountry").bind("changed", function () {
            ajaxquery("/GetList/CitiesOfCountry", { "id": $(this).attr("value") }, function (data) {
                $("#cmbCity .combobox_items").html(data);
                handleComboBoxItem();
                $("#cmbCity .combobox_items").trigger("change");
            });
        });
        $("#accountmenuitem_changeinfomation").addClass("active");
        $("#txtDOB").DatePicker({
            format: 'd/m/Y',
            date: $('#txtDOB').val(),
            current: $('#txtDOB').val(),
            starts: 1,
            position: 'bottom',
            onBeforeShow: function () {
                $('#txtDOB').DatePickerSetDate($('#txtDOB').val(), true);
            },
            onChange: function (formated, dates) {
                $('#txtDOB').val(formated);
            }
        });
    });
</script>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%
    int lang = 2;
    VietImage.Roles.RegisteredUserRole role = (VietImage.Roles.RegisteredUserRole)Session["Role"];
    if (role != null)
    {
        txtFirstName.Value = role.UserInfo.GetDetail(lang).Firstname;
        txtLastName.Value = role.UserInfo.GetDetail(lang).Lastname;
        txtDOB.Value = role.UserInfo.Birthday.Value.ToString("d/M/yyyy");
        txtEmail.Value = role.UserInfo.Email;
        txtPhone.Value = role.UserInfo.Cellfone;
        txtAddress.Value = role.UserInfo.GetDetail(lang).Address;
%>
<div class="form">
<form id="frmchangeinfo" name="changeinfo" method="POST" action="/Account">
    <div class="formrow">
        <div class="formlabel">Tên</div>
        <div class="left">
            <uc:textbox ID="txtFirstName" runat="server" />
        </div>
        <div class="clear"></div>
    </div>

    <div class="formrow">
        <div class="formlabel">Họ</div>
        <div class="left">
            <uc:textbox ID="txtLastName" runat="server" />
        </div>
        <div class="clear"></div>
    </div>

    <div class="formrow">
        <div class="formlabel">Ngày sinh</div>
        <div class="left">
            <uc:textbox ID="txtDOB" runat="server" />
        </div>
        <div class="clear"></div>
    </div>

    <div class="formrow">
        <div class="formlabel">Nơi ở</div>
            <div class="left">Quốc gia</div>
            <div id="cmbCountry" class="combobox" value="">
                <input id="cmbCo" name="cmbCo" value="" type="hidden" />
                <div class="combobox_selected"></div>
                <div class="combobox_button"></div>
                <div class="combobox_items">
<% 
    
        List<VietImage.Models.Country> CountryList = (List<VietImage.Models.Country>)ViewData["CountryList"];
        if (CountryList != null)
        {
            foreach (VietImage.Models.Country country in CountryList)
            {
                
%>
                    <div class="combobox_item" value="<%= country.ID %>" <%= ((role.UserInfo.City.ID_Country == country.ID)?"selected":"") %> ><%= country.Name%></div>
<%
            }
        }
        
%>
                </div>
            </div>
            <div class="left">Thành phố</div>
            <div id="cmbCity" class="combobox" value="">
                <input id="cmbCi" name="cmbCi" value="" type="hidden" />
                <div class="combobox_selected"></div>
                <div class="combobox_button"></div>
                <div class="combobox_items">
<% 
        List<VietImage.Models.City> CityList = (List<VietImage.Models.City>)ViewData["CityList"];
        if (CityList != null)
        {
            foreach (VietImage.Models.City city in CityList)
            {
                
%>
                    <div class="combobox_item" value="<%= city.ID %>" <%= ((role.UserInfo.City.ID == city.ID)?"selected":"") %> ><%= city.Name%></div>
<%
            }
        }   
%>
                </div>
            </div>
        <div class="clear"></div>
    </div>

    <div class="formrow">
        <div class="formlabel">Giới tính</div>
        <div class="left">
            <div id="cmbX" class="combobox" value="">
                <input id="cmbSx" name="cmbSx" value="" type="hidden" />
                <div class="combobox_selected"></div>
                <div class="combobox_button"></div>
                <div class="combobox_items">
                    <div class="combobox_item" value="1" <%= ((role.UserInfo.Gender == 1)?"selected":"") %> >Nam</div>
                    <div class="combobox_item" value="2" <%= ((role.UserInfo.Gender != 1)?"selected":"") %>>Nữ</div>
                </div>
            </div>
        </div>
        <div class="clear"></div>
    </div>

    <div class="formrow">
        <div class="formlabel">Email</div>
        <div class="left">
            <uc:textbox ID="txtEmail" runat="server" />
        </div>
        <div class="clear"></div>
    </div>

    <div class="formrow">
        <div class="formlabel">Số điện thoại</div>
        <div class="left">
            <uc:textbox ID="txtPhone" runat="server" />
        </div>
        <div class="clear"></div>
    </div>

    <div class="formrow">
        <div class="formlabel">Địa chỉ</div>
        <div class="left">
            <uc:textarea ID="txtAddress" runat="server" />
        </div>
        <div class="clear"></div>
    </div>

    <div class="formrow">
        <div class="formlabel">Ngày đăng ký</div>
        <div class="left">
            <%= role.UserInfo.CreatedTime.ToString("d/M/yyyy") %>
        </div>
        <div class="clear"></div>
    </div>

    <div class="formrow">
        <div class="formlabel">Mật khẩu cũ</div>
        <div class="left">
            <uc:textbox ID="txtPwd" Type="password" runat="server" />
        </div>
        <div class="clear"></div>
    </div>

    <div class="formrow">
        <div class="formlabel">Mật khẩu mới</div>
        <div class="left">
            <uc:textbox ID="txtNewPwd" Type="password" runat="server" />
        </div>
        <div class="clear"></div>
    </div>

    <div class="formrow">
        <div class="formlabel">Nhập lại mật khẩu</div>
        <div class="left">
            <uc:textbox ID="txtNewPwd2" Type="password" runat="server" />
        </div>
        <div class="clear"></div>
    </div>


    <div class="formrow">
        <div class="formlabel"></div>
        <uc:button Type="submit" Value="Lưu" runat="server" />
        <uc:button Type="reset" Value="Hủy" runat="server" />
        <div class="clear"></div>
    </div>
</form>
</div>
<% 
    }    
%>



</asp:Content>
